package guoanmaker.provider.business.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import guoanmaker.provider.business.model.PersonalCollection;

public interface PersonalCollectionRepository extends JpaRepository<PersonalCollection, String>, JpaSpecificationExecutor<PersonalCollection>{
	 //通过用户id和商品id查询是否添加收藏
	@Query("select p from PersonalCollection p where p.personalUser.id=:userId and p.provideCommodity.id=:commodityId")
	 List<PersonalCollection> findByPersonalUser_idIsAndProvideCommodity_idIs(@Param("userId")String userId,@Param("commodityId")String commodityId);
}
